﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "GbmpModel.h"
#include "IDocument.h"
#include "IClonedElementPostProcessor.h"
namespace gcmp
{
    class IElement;

    //==============================================================================
    //一个对象被拷贝后的后处理（主要是业务相关）：
    //1、当一个连接相关的对象被拷贝（比如带有连接的主体构件，或者连接本身）
    //   因为【主体】与【连接】相互关联，但它们拷贝生成时间是有先后的，在拷
    //   贝后一个对象时，需要视情况调整与其相关联的对象的状态
    //2、当一个开洞关系的对象被拷贝（同上）
    class GbmpClonedElementPostProcessor : public IClonedElementPostProcessor
    {
    public:
        bool Do(IElement* pElement) override;

    private:
        //如果是连接件
        bool ProcessJoinableElement(IElement* pElement);

        //如果是连接本身
        bool ProcessJoinElement(IElement* pElement);

        //如果是开洞本身
        bool ProcessOpenElement(IElement* pElement);

        //如果是开洞或被开洞对象
        bool ProcessOpenedOrOpeningElement(IElement* pElement);
    };
}





